export default {
  namespaced: true,

  state: {
    //如果本地有token 那么优先使用本地数据
    token:localStorage.getItem('token') ? localStorage.getItem('token'):'' //存储token数据
  },
  mutations: {
    //函数1
    //函数2
    setToken(state, newToken) {
      state.token = newToken   
      //更新仓库的token数据
      localStorage.setItem('token',newToken)
    //存储数据到本地
    },
    removeToken(state){
      state.token = '',
      localStorage.removeItem('token')
    }
  },
  actions: {}
}
